package com.asj.service.command.specific;

import static com.asj.enums.DeviceIdentifierDictEnums.clearScreenLockPassword;
import static com.asj.enums.DeviceIdentifierDictEnums.syncDeviceInfo;
import static com.asj.enums.HttpRequestDictEnums.receiveClearPasswordUrl;
import static com.asj.enums.ResultCodeEnums.request_error;
import static com.asj.enums.ResultCodeEnums.result_error;
import static com.asj.enums.ResultCodeEnums.result_success;

import android.content.Context;
import android.util.Log;

import com.asj.MainActivity;
import com.asj.service.oppoSdk.OPPOSDKService;
import com.asj.utils.CommonsUtils;
import com.asj.utils.HttpRequestUtils;
import com.asj.utils.JSONParamPackingUtils;
import com.google.gson.JsonObject;

/**
 * 清除锁屏密码
 * */
public class SpecificClearScreenLockPasswordService {
    public static void clearScreenLockPassword(JsonObject contentData, Context context){
        try {
            new OPPOSDKService(contentData, context).setPassword("false", null);
            JSONParamPackingUtils.functionPacking(contentData,result_success, null);
        } catch (Exception e){
            JSONParamPackingUtils.functionPacking(contentData,result_error, e.getMessage());
        }
        new Thread(()->{
            //将请求发送回去
            String result = HttpRequestUtils.retryHttpRequest(receiveClearPasswordUrl.getValue(), contentData.toString(), result_success.getCode(), 5,context);
            if(!result.equals(request_error.getMessage())){
                Log.i("清除锁屏密码已返回结果，告知成功！",result);
            }
        }).start();
    }
}
